<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>团长资料</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/common.css" />
    <link rel="stylesheet" type="text/css" href="../../css/group-create-captain.css" />
</head>

<body>
	
	 <div id="wrap">
		<div id="main">
		
			<div class="captain">
				
				<div class="captain-header-title">
					团长姓名
				</div>
				<input  id="name" class="captain-input" placeholder="团长真实姓名" />
				
				<div class="captain-header-title">
					团长电话
				</div>
				<input id="phone" class="captain-input" placeholder="输入联系方式" />
				
				<div class="captain-header-title">
					团长简介
				</div>
				<textarea id="intro" rows="5" placeholder="输入跑团介绍，15-300个字" class="captain-textarea"></textarea>
				
				<div></div>
				
				<div class="btn-captain-submit" onclick="submitCreateGroup()">提交审核</div>
				
			</div>
			
		</div>
	</div>
	
	
</body>

<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>

<script>
	function submitCreateGroup() {
		var group_name = $api.getStorage('create-group-name');
		var group_intro = $api.getStorage('create-group-intro');
		var group_fee = $api.getStorage('create-group-fee');
		var group_need_fee = $api.getStorage('create-group-needfee');
		var group_banner = $api.getStorage('create-group-banner');		
				
		var chief_name = $api.byId('name').value;
		var chief_phone = $api.byId('phone').value;
		var chief_intro = $api.byId('intro').value;
				
		var bodyParam = {
			name: group_name,
			intro: group_intro,
			membershipFee: group_fee,
			banner: group_banner,
			chiefName: chief_name,
			chiefPhone: chief_phone,
			chiefIntro: chief_intro,
			identityCard1: '1',
			identityCard2: '2',
			identityCard3: '3',
			tags: [0, 1]
		}
		
		api.showProgress({
	        title: '正在创建跑团',
	        modal: false
	    });
	    
	    var urlCreateGroup = "group";
	    
	    ajaxRequest(urlCreateGroup, 'post', JSON.stringify(bodyParam), function (ret, err) {
	        if (ret) {
				        
				alert(ret.id);
	           	alert('success');
	                        
	        } else {
	        		// TODO
	            api.alert({
	                msg: err.msg
	            });
	        }
	        
	        api.hideProgress();
	    })
		
		
	}
</script>
</html>